import request from '@/utils/request'

/**
 * 添加评论/添加评论回复
 * @param {*} data
 */
export const addComment = (data) => {
  return request({
    url: '/app/v1_0/comments',
    method: 'POST',
    data
  })
}

/**
 * 获取评论/获取评论回复
 * @param {*} data
 */
export const getComments = (params) => {
  return request({
    url: '/app/v1_0/comments',
    method: 'GET',
    params
  })
}

/**
 * 对评论点赞
 */
export function addCommentLike (commentId) {
  return request({
    method: 'POST',
    url: '/app/v1_0/comment/likings',
    data: {
      target: commentId
    }
  })
}

/**
   * 取消对评论点赞
   */
export function deleteCommentLike (commentId) {
  return request({
    method: 'DELETE',
    url: '/app/v1_0/comment/likings/' + commentId
  })
}
